﻿using System.Drawing;
using RaytracerLib.Layers;
using RaytracerLib.MathLib;
using TomanuExtensions;

namespace RaytracerLib.Postprocessing
{
    public class GammaLinearToSRGB : Postprocessor
    {
        internal override void Postprocess(Rectangle a_src_rect, ColorArrayFloat a_ar)
        {
            foreach (var p in a_src_rect.EnumPixels())
            {
                ColorFloat c = a_ar.GetColor(p.X, p.Y);
                c = Gamma.LinearToSRGB(c);
                a_ar.SetColor(p.X, p.Y, c);
            }
        }
    }
}